<nav class="navbar navbar-default">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <%= link_to "Home", root_path, class: "navbar-brand" %>
    </div>

    <!-- collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active">
          <%= link_to "Products", products_path %>
        </li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li>
          <%= link_to carts_path do %>
          Cart <i class="fa fa-shopping-cart"></i>( <%= current_cart.products.count %> )
          <% end %>
        </li>
        <li>
          <%= link_to account_orders_path do %>
          Account Order <i class="fa fa-dollar"></i>
          <% end %>
        </li>
        <% if !current_user %>
          <li><%= link_to "Regist", new_user_registration_path %></li>
          <li><%= link_to content_tag(:i, ' Login', class: 'fa fa-sign-in'), new_user_session_path %></li>
        <% else %>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
              Hi, <%= current_user.email %>
              <b class="caret"></b>
            </a>
            <ul class="dropdown-menu">
              <% if current_user.admin? %>
                <li> <%= link_to "Admin Panel", admin_products_path %> </li>
              <% end %>
                <li> <%= link_to content_tag(:i, ' Logout', class: 'fa fa-sign-out'), destroy_user_session_path, method: :delete %></li>
            </ul>
          </li>
        <% end %>
      </ul>
    </div>

  </div>
</nav>
